#ifndef CENTER_H
#define CENTER_H

#include <QSystemTrayIcon>
#include <QIcon>
#include <QWidget>
#include <QMenu>
#include "CRunServer.h"
#include "Widget.h"
namespace Ui {
class CEnter;
}
class CEnter:public QWidget
{
    Q_OBJECT
public:
    CEnter(QWidget*parent=0);

    ~CEnter(){
        delete _trayIcon;
    }
protected slots:
    void onActiveTray(QSystemTrayIcon::ActivationReason reason);
    void onShowMenu();
    void onShowWindow();
    void onShowMessage();
    void onClose();
    void onRunserver();
    void onLogin();
protected:
    void setIcon(const QString &icon);
    void setTitle(const QString&title);
    void closeEvent(QCloseEvent *event);
    void initMenu();
    void mouseMoveEvent(QMouseEvent *e);
    void mousePressEvent(QMouseEvent *e);
protected:
    QSystemTrayIcon*_trayIcon;
    CRunServer*server;
    Widget*client;
    Ui::CEnter *ui;
    QPoint pressPosition;
};

#endif // CENTER_H
